#include "app_porting.h"

#define LED0 GPIO_Pin_10	
#define LED0_PORT GPIOC

void led_init(void)
{
	GPIO_InitTypeDef GPIO_InitStructure;

	GPIO_InitStructure.GPIO_Pin   =  LED0;
	GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
	GPIO_InitStructure.GPIO_Mode  = GPIO_Mode_Out_PP;
	GPIO_Init(LED0_PORT, &GPIO_InitStructure);
	debug_led_onoff(0);
}

void debug_led_onoff(uint8_t onoff)
{
	if(onoff){
		GPIO_WriteBit(LED0_PORT,LED0,Bit_RESET);
	}else{
		GPIO_WriteBit(LED0_PORT,LED0,Bit_SET);
	}
}

void debug_led_reverse(void)
{
	static uint8_t initialized;
	static uint8_t flag;
	if(!initialized){
		led_init();
		initialized=1;
	}
	if(flag){
		debug_led_onoff(1);
		flag=0;
	}else{
		debug_led_onoff(0);
		flag=1;	
	}
}

